package so.sao.shop.supplier.dao;

/**
 * Created by lenovo on 2017/7/7.
 */

import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import so.sao.shop.supplier.domain.User;
import so.sao.shop.supplier.pojo.input.auth.AdminUserStatusInput;
import so.sao.shop.supplier.pojo.vo.UserVo;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by lenovo on 2017/7/7.
 */
@Mapper
public interface UserDao {
	User findOne(@Param("id") Long id);

	public UserVo findByUserId(@Param("userId") Long userId);

	int countPage(@Param("page") Page page);

	List findPage(@Param("page") Page page);
	/**
	 * 查询所有的user
	 * @param map
	 * @return
	 */
	public List<Map<String,Object>> findAll(Map<String,Object> map);

	User findByUsername(String username);

	int updatePassword(@Param("userId") Long userId, @Param("loginPassword") String loginPassword,
			@Param("lastPasswordResetDate") Date lastPasswordResetDate);

	public int updateByPrimaryKey(User user);

	int saveSmsCode(@Param("tel") String tel, @Param("code") String code);

	String findSmsCode(Long userId);

	int add(User user);

	public int insertSelective(User record);

	void update(@Param("id") Long id, @Param("tel") String tel);

	int updateLogoutTime(@Param("userId") Long userId, @Param("logoutTime") Date logoutTime);

	/**
	 * 根据登录名查询用户信息
	 * 
	 * @param loginName
	 *            登录名称
	 * @return 用户对象
	 */
	User findByLoginName(String loginName);

	/**
	 * 更改管理员子账号状态
	 * 
	 * @param userStatusInput
	 */
	void updateUserStatus(AdminUserStatusInput userStatusInput);

}